<script setup lang="ts">
import { onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";

onMounted(() => {
  const route = useRoute();
  //   alert(route.params.id);
  //   alert(JSON.stringify(route.query));
});
//自定义hook的特性 必须在最顶层声明才可以使用·
const router = useRouter();
const back = () => {
  router.back();
  // router.go(-1) // 返回
};
</script>

<template>
  主页
  <button @click="back">返回</button>
</template>

<style scoped></style>
